/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clueless;

/**
 *
 * @author dcain
 */
public class SuggAccDialog extends javax.swing.JFrame {

    /**
     * Creates new form SuggAccDialog
     */
    String outMessage;
    
    public SuggAccDialog() {
        initComponents();
    }
    
    public SuggAccDialog(String buttonText) {
        initComponents();
        sendButton.setText(buttonText);        
        kitchenButton.setEnabled(true);
        kitchenButton.setSelected(true);
        ballButton.setEnabled(true); 
        conButton.setEnabled(true);  
        libButton.setEnabled(true);  
        loungeButton.setEnabled(true);
        hallButton.setEnabled(true);  
        studyButton.setEnabled(true);
        billButton.setEnabled(true);  
        diningButton.setEnabled(true);
    }
    
    
    
    public SuggAccDialog(String buttonText, String loc) {
        initComponents();
        sendButton.setText(buttonText);
        
        switch(loc){
            case "Kitchen":
                kitchenButton.setSelected(true);
                kitchenButton.setEnabled(true);        
                break;
            case "Ballroom":
                ballButton.setSelected(true);
                ballButton.setEnabled(true);        
                break;
            case "Conservatory":
                conButton.setSelected(true);
                conButton.setEnabled(true);        
                break;
            case "Library":
                libButton.setSelected(true);
                libButton.setEnabled(true);        
                break;
            case "Lounge":
                loungeButton.setSelected(true);
                loungeButton.setEnabled(true);        
                break;
            case "Hall":
                hallButton.setSelected(true);
                hallButton.setEnabled(true);        
                break;
            case "Study":
                studyButton.setSelected(true);
                studyButton.setEnabled(true);        
                break;
            case "Billiard_Room":
                billButton.setSelected(true);
                billButton.setEnabled(true);        
                break;
            case "Dining_Room":
                diningButton.setSelected(true);
                diningButton.setEnabled(true);  
                break;
            }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        candleButton = new javax.swing.JRadioButton();
        knifeButton = new javax.swing.JRadioButton();
        pipeButton = new javax.swing.JRadioButton();
        revButton = new javax.swing.JRadioButton();
        ropeButton = new javax.swing.JRadioButton();
        wrenchButton = new javax.swing.JRadioButton();
        musButton = new javax.swing.JRadioButton();
        scarButton = new javax.swing.JRadioButton();
        plumButton = new javax.swing.JRadioButton();
        greenButton = new javax.swing.JRadioButton();
        whiteButton = new javax.swing.JRadioButton();
        peaButton = new javax.swing.JRadioButton();
        kitchenButton = new javax.swing.JRadioButton();
        ballButton = new javax.swing.JRadioButton();
        conButton = new javax.swing.JRadioButton();
        diningButton = new javax.swing.JRadioButton();
        billButton = new javax.swing.JRadioButton();
        libButton = new javax.swing.JRadioButton();
        loungeButton = new javax.swing.JRadioButton();
        hallButton = new javax.swing.JRadioButton();
        studyButton = new javax.swing.JRadioButton();
        sendButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        buttonGroup1.add(candleButton);
        candleButton.setSelected(true);
        candleButton.setText("Candle");

        buttonGroup1.add(knifeButton);
        knifeButton.setText("Knife");

        buttonGroup1.add(pipeButton);
        pipeButton.setText("Pipe");

        buttonGroup1.add(revButton);
        revButton.setText("Revolver");

        buttonGroup1.add(ropeButton);
        ropeButton.setText("Rope");

        buttonGroup1.add(wrenchButton);
        wrenchButton.setText("Wrench");

        buttonGroup2.add(musButton);
        musButton.setSelected(true);
        musButton.setText("Col Mustard");

        buttonGroup2.add(scarButton);
        scarButton.setText("Miss Scarlet");

        buttonGroup2.add(plumButton);
        plumButton.setText("Prof Plum");

        buttonGroup2.add(greenButton);
        greenButton.setText("Mr Green");

        buttonGroup2.add(whiteButton);
        whiteButton.setText("Mrs White");

        buttonGroup2.add(peaButton);
        peaButton.setText("Mrs Peacock");

        buttonGroup3.add(kitchenButton);
        kitchenButton.setText("Kitchen");
        kitchenButton.setEnabled(false);

        buttonGroup3.add(ballButton);
        ballButton.setText("Ballroom");
        ballButton.setEnabled(false);

        buttonGroup3.add(conButton);
        conButton.setText("Conservatory");
        conButton.setEnabled(false);

        buttonGroup3.add(diningButton);
        diningButton.setText("Dining Room");
        diningButton.setEnabled(false);

        buttonGroup3.add(billButton);
        billButton.setText("Billiard Room");
        billButton.setEnabled(false);

        buttonGroup3.add(libButton);
        libButton.setText("Library");
        libButton.setEnabled(false);

        buttonGroup3.add(loungeButton);
        loungeButton.setText("Lounge");
        loungeButton.setEnabled(false);

        buttonGroup3.add(hallButton);
        hallButton.setText("Hall");
        hallButton.setEnabled(false);

        buttonGroup3.add(studyButton);
        studyButton.setText("Study");
        studyButton.setEnabled(false);

        sendButton.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        sendButton.setText("Suggest!");
        sendButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sendButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(candleButton)
                    .addComponent(knifeButton)
                    .addComponent(pipeButton)
                    .addComponent(revButton)
                    .addComponent(ropeButton)
                    .addComponent(wrenchButton))
                .addGap(65, 65, 65)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(sendButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(musButton)
                            .addComponent(scarButton)
                            .addComponent(plumButton)
                            .addComponent(greenButton)
                            .addComponent(whiteButton)
                            .addComponent(peaButton))
                        .addGap(65, 65, 65)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(libButton)
                            .addComponent(billButton)
                            .addComponent(diningButton)
                            .addComponent(conButton)
                            .addComponent(ballButton)
                            .addComponent(kitchenButton)
                            .addComponent(loungeButton)
                            .addComponent(hallButton)
                            .addComponent(studyButton))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(48, 48, 48)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(candleButton)
                    .addComponent(musButton)
                    .addComponent(kitchenButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(knifeButton)
                    .addComponent(scarButton)
                    .addComponent(ballButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(pipeButton)
                    .addComponent(plumButton)
                    .addComponent(conButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(revButton)
                    .addComponent(greenButton)
                    .addComponent(diningButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ropeButton)
                    .addComponent(whiteButton)
                    .addComponent(billButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(wrenchButton)
                    .addComponent(peaButton)
                    .addComponent(libButton))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(loungeButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(hallButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(studyButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
                .addComponent(sendButton, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(51, 51, 51))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendButtonActionPerformed
        String[] selected = new String[3];        
            if(candleButton.isSelected()){
                selected[0] = "Candlestick";
            } else if (knifeButton.isSelected()){
                selected[0] = "Knife";
            } else if (pipeButton.isSelected()){
                selected[0] = "Pipe";
            } else if (revButton.isSelected()){
                selected[0] = "Revolver";
            } else if (wrenchButton.isSelected()){
                selected[0] = "Wrench";
            } else if (ropeButton.isSelected()){
                selected[0] = "Rope";
            }
            
            if(musButton.isSelected()){
                selected[1] = "Mustard";
            } else if (scarButton.isSelected()){
                selected[1] = "Scarlet";
            } else if (plumButton.isSelected()){
                selected[1] = "Plum";
            } else if (greenButton.isSelected()){
                selected[1] = "Green";
            } else if (whiteButton.isSelected()){
                selected[1] = "White";
            } else if (peaButton.isSelected()){
                selected[1] = "Peacock";           
            }
            
            if(kitchenButton.isSelected()){
                selected[2] = "Kitchen";
            } else if (ballButton.isSelected()){
                selected[2] = "Ballroom";
            } else if (conButton.isSelected()){
                selected[2] = "Conservatory";
            } else if (libButton.isSelected()){
                selected[2] = "Library";
            } else if (loungeButton.isSelected()){
                selected[2] = "Lounge";
            } else if (hallButton.isSelected()){
                selected[2] = "Hall";
            } else if (studyButton.isSelected()){
                selected[2] = "Study";
            } else if (billButton.isSelected()){
                selected[2] = "Billiard_Room";
            } else if (diningButton.isSelected()){
                selected[2] = "Dining_Room";
            }
            if(sendButton.getText().contains("Accuse")){
                Clueless.sendAccuse(selected);
                dispose();
                
            } else {
                Clueless.sendSuggest(selected);
                dispose();
            }
            
            
            
           // System.exit(1);;
    }//GEN-LAST:event_sendButtonActionPerformed

    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /* Set the Nimbus look and feel */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
//         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(SuggAccDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(SuggAccDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(SuggAccDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(SuggAccDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /* Create and display the form */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                new SuggAccDialog().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JRadioButton ballButton;
    private javax.swing.JRadioButton billButton;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.JRadioButton candleButton;
    private javax.swing.JRadioButton conButton;
    private javax.swing.JRadioButton diningButton;
    private javax.swing.JRadioButton greenButton;
    private javax.swing.JRadioButton hallButton;
    private javax.swing.JRadioButton kitchenButton;
    private javax.swing.JRadioButton knifeButton;
    private javax.swing.JRadioButton libButton;
    private javax.swing.JRadioButton loungeButton;
    private javax.swing.JRadioButton musButton;
    private javax.swing.JRadioButton peaButton;
    private javax.swing.JRadioButton pipeButton;
    private javax.swing.JRadioButton plumButton;
    private javax.swing.JRadioButton revButton;
    private javax.swing.JRadioButton ropeButton;
    private javax.swing.JRadioButton scarButton;
    private javax.swing.JButton sendButton;
    private javax.swing.JRadioButton studyButton;
    private javax.swing.JRadioButton whiteButton;
    private javax.swing.JRadioButton wrenchButton;
    // End of variables declaration//GEN-END:variables
}
